#include "DemoApp.h"
#include "global.h"

DemoApp::DemoApp()
{

}

DemoApp::~DemoApp()
{

}

void DemoApp::one_frame()
{
	for (int i = 0; i < 10; ++i)
	{
		demoglobal::g_p_renderer->render();
		demoglobal::g_p_camera->move_x(1.f);
		//demoglobal::g_p_camera->move_y(-1.f);

		Spears::Texture2D const* p_tex = demoglobal::g_p_renderer->get_render_target();

		std::stringstream ss;
		ss << "../../../test/outputs/nop-" << i << ".ppm";
		Spears::Utils::BitmapUtil::save_to_ppm_p6(ss.str(), p_tex);
	}

}

bool DemoApp::before_frame()
{
	return true;
}

void DemoApp::in_frame()
{
	demoglobal::g_p_renderer->render();
	Spears::Texture2D const* p_tex = demoglobal::g_p_renderer->get_render_target();

	static int cnt = 0;

	printf("count = %d \r", cnt++);
	
}

void DemoApp::after_frame()
{

}